package com.sykj.manage.service.imp;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sykj.manage.dao.ParamDao;
import com.sykj.manage.service.SysParamService;
import com.sykj.manage.model.SysParam;

@Service
public class SysParamServiceImpl implements SysParamService{
	/**
	 * 调用参数设置持久层接口类
	 */
	@Autowired
	ParamDao sysparamdao;
	
	/**
	 * 实现持久层根据id查的接口
	 */
	@Override
	public Map<String, SysParam> allSysparamdao() {
		// TODO Auto-generated method stub
		List<SysParam> params = sysparamdao.allSysparamdao();
		Map<String, SysParam> paramMap = new HashMap<String, SysParam>();
		for (SysParam item : params) {
			paramMap.put(item.getParam_key(), item);
		}
		return paramMap;
	}
	
	/**
	 * 实现持久层修改单个value
	 */
	@Override
	public void updateSysParams(List<SysParam> paramsList) {
		for (SysParam param:paramsList) {
			sysparamdao.updateSysParam(param);
		}
	}
	
	
	
	
	
	@Override
	public List<SysParam> findParams(SysParam sysParam) {
		// TODO Auto-generated method stub
		return sysparamdao.findParams(sysParam);
	}

	@Override
	public int delParams(Object[] param_id) {
		// TODO Auto-generated method stub
		return sysparamdao.delParams(param_id);
	}

	@Override
	public SysParam findParamById(String param_id) {
		// TODO Auto-generated method stub
		return sysparamdao.findParamById(param_id);
	}

	@Override
	public int addParam(SysParam sysParam) {
		// TODO Auto-generated method stub
		return sysparamdao.addParam(sysParam);
	}

	@Override
	public int updParam(SysParam sysParam) {
		// TODO Auto-generated method stub
		return sysparamdao.updParam(sysParam);
	}

}
